#pragma once
#include<iostream>
#include<pthread.h>
#include"Mutex.hpp"
using namespace LockModule;
namespace condMoudle
{
    class cond
    {
    private:
        pthread_cond_t _cond;
    public:
        cond(/* args */)
        {
            int n = ::pthread_cond_init(&_cond, nullptr);
        }
        void wait(Mutex& mutex) // 让我们释放曾将持有的锁
        {
            int n = pthread_cond_wait(&_cond, mutex.lockPtr());
        }
        void notify()
        {
            int n = ::pthread_cond_signal(&_cond);
        }
        void notifyAll()
        {
            int n = ::pthread_cond_broadcast(&_cond);
        }
        ~cond()
        {
            ::pthread_cond_destroy(&_cond);
        }
    };
    
    
}